from django.contrib import admin

# Register your models here.
from system.models import Slider, News, ImageFile
from utils.admin_actions import set_invalid, set_valid

@admin.register(News)
class NewsAdmin(admin.ModelAdmin):
    """"""
    # 显示的列表标题抬头
    list_display = ('title', 'types', 'is_valid')
    # 修改分页数据的大小
    list_per_page = 5
    # 设置过滤器
    list_filter = ('is_valid',)
    # 设置下拉框
    actions = [set_invalid, set_valid]

@admin.register(Slider)
class SliderAdmin(admin.ModelAdmin):
    """"""
    # 显示的列表标题抬头
    list_display = ('name', 'desc', 'types', 'is_valid')
    # 修改分页数据的大小
    list_per_page = 5
    # 设置过滤器
    list_filter = ('is_valid',)
    # 设置下拉框
    actions = [set_invalid, set_valid]

@admin.register(ImageFile)
class ImageFileAdmin(admin.ModelAdmin):
    """"""
    # 显示的列表标题抬头
    list_display = ('img', 'summary', 'content_object', 'is_valid')
    # 修改分页数据的大小
    list_per_page = 5
    # 设置过滤器
    list_filter = ('is_valid',)
    # 设置下拉框
    actions = [set_invalid, set_valid]

